package com.spirngboot.middleware.middleware_rabbitmq.server.service.topic;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Component;

@Component
@RabbitListener(bindings = @QueueBinding(
        value = @Queue(value = "email.fanout.queue", durable = "true", autoDelete = "false"),
        exchange = @Exchange(value = "topic-order-exchange", type = ExchangeTypes.TOPIC),
        key = "#.email.#"
))
public class EmailTopicConsumer {
    private static final Logger log = LoggerFactory.getLogger(EmailTopicConsumer.class);

    @RabbitHandler
    public void receiveMessage(String message) {
        //省略Email相关业务
        log.info("{}接收到订单信息:{}", log.getName(), message);
    }
}
